package com.lzp.controller;

import com.lzp.utils.Resource;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.ModelMap;
import org.springframework.web.bind.annotation.RequestMapping;

/**
 * @description: Freemarker API
 * @author: lzp
 * @createTime: 2021-07-26 23:37
 **/
@Controller
@RequestMapping("ftl")
public class FreemarkerController {

    @Autowired
    private Resource resource;

    /**
     * 测试向页面注入属性
     *
     * @param modelMap
     * @return
     */
    @RequestMapping("/index")
    public String index(ModelMap modelMap) {
        modelMap.addAttribute("resource", resource);
        return "freemarker/index";
    }

    /**
     * 测试多层路径，不需要加后缀
     *
     * @return
     */
    @RequestMapping("/center")
    public String center() {
        return "freemarker/center/center";
    }

}
